This script lists  into a window of the "Scriptable Text Editor" the files and folders contained in a volume or a folder. Note that it is very slow (AppleScript is to blame). Also note that the Scriptable Text Editor only accepts up to 32000 characters. Therefore, you are likely to fail if you list more than 1000 items!
When you are prompted for a "wildcarded name", you can clear it and then click on "list also folders". This will list the whole hierarchy of folders without listing any file.